<template>
    <div class="resultData">
        <div class="resultDetail">
            <div class="projectPic">
                <img :src="avatar" alt="Fail">
            </div>
            <div class="detail">
                <div class="projectName">
                    <slot name="courseName"></slot>
                </div>
                <div class="projectIntro">课程简介：
                    <slot name="intro"></slot>
                </div>
            </div>
        </div>
        <div class="resultOper">
            <div class="left">
                <div class="light" :style="{'background-color': color}" ref="light"></div>
                <div class="state">
                    <slot name="state"></slot>
                </div>
                <div class="date">
                    <slot name="date"></slot>
                </div>
            </div>
            <div class="right" @click="EditCourseInfo">
                ...
            </div>
        </div>
    </div>
</template>
<script setup>
import { onMounted, ref } from 'vue';
import avatar from '../assets/images/teacher/public/信息.svg';

const props = defineProps({
    state: String
})

const color = ref('yellow')

if(props.state == '已审核'){
    color.value = 'green'
}else if(props.state == '已失效'){
    color.value = 'red'
}else{
    color.value = 'yellow'
}


//进入编辑课程
const EditCourseInfo = function(){
    router.push('/EditCourseInfo')
}
</script>
<style scoped>
.resultData {
    width: 27%;
    height: 151px;
    background-color: rgb(255, 255, 255);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 30px;
    background-color: #ffffff;
    box-shadow: 2px 3px 6px 0px rgba(0, 0, 0, 0.16);
    border-radius: 10px;
    min-width: 200px;
    float: left;
    margin-right: 6.3%;
}

.resultDetail {
    width: 100%;
    height: 74%;
    display: flex;
    padding-left: 7%;
    padding-top: 7%;
    padding-bottom: 3%;
}


.projectPic {
    width: 23%;
    height: 100%;
    /* background-color: pink; */
    justify-content: center;
    align-items: center;
    min-width: 62px;
}

.projectPic img {
    width: 78%;
    height: 50%;
}

.detail {
    height: 100%;
    width: 77%;
    padding-right: 5%;
}

.projectName {
    font-family: Source Han Sans CN;
    font-size: 1.1em;
    font-weight: 550;
    font-stretch: normal;
    letter-spacing: 0px;
    color: #707070;
    margin-top: -6.9%;
    line-height: 2.7em;
    /* 不换行 */
    white-space: nowrap;
    /* 超出部分隐藏 */
    overflow: hidden;
    /* 文字超出的部分显示为省略号 */
    text-overflow: ellipsis;
    width: 100%;
}

.projectIntro {
    font-size: 0.8em;
    line-height: 0.9em;
    font-family: Source Han Sans CN;
    font-weight: normal;
    font-stretch: normal;
    letter-spacing: 0px;
    height: 58%;
    color: #707070;
    display: flex;
    white-space: normal;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
}

.projectIntro p {
    width: 100%;
    word-wrap: break-word;
}

.resultOper {
    width: 100%;
    height: 26%;
    background-color: #dbdde3;
    box-shadow: 2px 3px 6px 0px rgba(0, 0, 0, 0.16);
    border-radius: 0px 0px 10px 10px;
    opacity: 0.5;
    display: flex;
    justify-content: space-between;
    padding-left: 3.7%;
    padding-right: 3.7%;
    align-items: center;
}

.left {
    width: 70%;
    height: 100%;
    display: flex;
    align-items: center;
    font-size: 0.7em;
}

.light {
    width: 0.4em;
    height: 0.4em;
    box-sizing: content-box;
    margin-right: 3%;
    background-color: yellow;
    border-radius: 0.2em;
}

.state {
    font-size: 0.8em;
    box-sizing: content-box;
    margin-right: 2.5%;
    margin-top: 0.05%;
}

.right {
    width: 30%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    line-height: 100%;
    cursor: pointer;
}
</style>